#include <iostream>
using namespace std;
#include "stack.h"
#include <cctype>

int main() {
  Stack s1;
  char ch;
  unsigned long po;
  while (cin >> ch && toupper(ch) != 'Q') {
    while (cin.get() != '\n') {
      continue;
    }
    if (!isalpha(ch)) {
      cout << '\a';
      continue;
    }
    switch (ch) {
    case 'A':
    case 'a': {
      cout << "add:";
      cin >> po;
      if (s1.isfull()) {
        cout << "stack full" << endl;
      } else {
        s1.push(po);
      }
      break;
    }
    case 'P':
    case 'p': {
      if (s1.isempty()) {
        cout << "stack is empty" << endl;
      } else {
        s1.pop(po);
        cout << "po:" << po << endl;
      }
      break;
    }
    }
  }
  cout << "done..." << endl;
  return 0;
}
